package mr

//
// RPC definitions.
//
// remember to capitalize all names.
//

import (
	"os"
	"strconv"
)

//
// example to show how to declare the arguments
// and reply for an RPC.
//

type ExampleArgs struct {
	X int
}

type ExampleReply struct {
	Y int
}

const (
	MapPhase int = iota
	ReducePhase
	WaitPhase // task is not done, but worker should wait for
	ExitPhase
)

type TaskArgs struct {
	FileIndex int
	Phase     int
	Id        interface{}
}

type TaskReply struct {
	Phase                 int
	SplitFilename         string
	IntermediateFilenames []string
	Id                    interface{}

	NReduce        int
	FileIndex      int
	InputFilename  []string
	OutputFilename string
}

// Add your RPC definitions here.

// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the master.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.
func masterSock() string {
	s := "/var/tmp/824-mr-"
	s += strconv.Itoa(os.Getuid())
	return s
}
